package org.laobai.shop.admin.interceptor;

import java.util.Objects;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.HandlerInterceptor;

public class LoginInterceptor implements HandlerInterceptor{

	@Override
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
			throws Exception {
		Object object = request.getSession().getAttribute("ADMIN");
		
		if(Objects.isNull(object)){
			
			//TODO 重定向到登录页面please
			
			return false;
		}
		
		return true;
	}

}
